<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../../css/aui_font.css">
    <style>
        html,
        body {
            background-color: rgb(245, 245, 245);
            margin: 0;
        }

        .meney {
            width: 84vw;
            margin-left: 8vw;
            margin-top: 20px;
            background-color: #fff;
            height: 28vw;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            border-radius: 10px;
        }

        .meney .label {
            font-size: 12px;
            color: #ccc;
        }

        .meney .value {
            font-size: 20px;
            color: #000;
            margin-top: 10px;
        }

        .list {
            display: flex;
            justify-content: space-between;
            width: 84vw;
            margin-left: 8vw;
            flex-wrap: wrap;
        }

        .list .item {
            width: 38vw;
            height: 38vw;
            background-color: #fff;
            margin-top: 20px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }

        .list .item:last-child {
            margin-bottom: 20px;
        }

        .list .item img {
            height: 30%;
            width: 70%;
            margin-bottom: 10px;
            object-fit: contain;
        }

        .list .item .value {
            font-size: 14px;
            margin: 4px 0;
        }

        .list .item .label {
            font-size: 12px;
            color: rgb(230, 138, 0);
        }

        .duimodal {
            position: fixed;
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
            background-color: rgba(0, 0, 0, .2);
        }

        .duibox {
            position: absolute;
            top: calc(50% - 130px);
            left: calc(50% - 130px);
            padding: 30px;
            width: 200px;
            height: 200px;
            background: #fff;
            display: flex;
            align-items: center;
            justify-content: space-around;
            flex-direction: column;
            border-radius: 10px;
        }

        .duibox img {
            height: 15%;
            width: 35%;
            object-fit: contain;
            margin: 20px 0;
        }

        .duibox .label {
            font-size: 12px;
            color: #ccc;
        }

        .new-submit {
            width: 44%;
            line-height: 30px;
            background: linear-gradient(to right, rgb(93, 161, 255), rgb(249, 61, 255));
            color: #ffffff;
            font-size: 12px;
            text-align: center;
            border-radius: 5px;
        }

        .aui-icon-close {
            position: absolute;
            right: 16px;
            top: 16px;
            font-size: 16px;
        }
    </style>
</head>

<body>
    <div id="view" v-cloak>
        <div class="meney">
            <div class="label">我的钻石</div>
            <div class="value">{{myMoney}}</div>
        </div>
        <div class="list">
            <div class="item" v-for="(item,index) in ffList" @click="clickHandle(index)">
                <img src="../../image/coin.png" alt="">
                <div class="value">{{item.money}}</div>
                <div class="label">{{item.price}}积分</div>
            </div>
        </div>
        <div class="duimodal" v-show="duimodal">
            <div class="duibox">
                <img src="../../image/coin.png" alt="">
                <div class="value">{{ffInfo.money}}</div>
                <div class="label">需消耗 {{ffInfo.price}}积分</div>
                <div class="new-submit" @click="confirm">确认兑换</div>
                <span class="aui-iconfont aui-icon-close" @click="duimodal = false"></span>
            </div>
        </div>
    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/jquery.js"></script>
<script type="text/javascript" src="../../script/ffkj.js"></script>
<script type="text/javascript" src="../../script/vue.js"></script>
<script type="text/javascript" src="../../json/tixian.js"></script>
<script type="text/javascript">
    var view = new Vue({
        el: '#view',
        data: {
            duimodal: false,
            imgurl: imgurl,
            ffList: retJson,
            ffInfo: {},
            ios: 1, // 1上架 0非上架
            myMoney: 0,
        },
        methods: {
            // 跳转
            _url(param, url) {
                _url(param, url);
            },
            // 返回图片路径
            returnImg(url) {
                return returnImg(url);
            },
            // 点击选择
            clickHandle(index) {
                console.log(index)
                view.ffInfo = view.ffList[index];
                this.duimodal = true;
            },
            // 确认
            confirm() {
                this.duimodal = false;
                // api.toast({
                //     msg: '兑换成功'
                // })
            }
        }
    })
    apiready = function() {
        getMyMoney();
    }

    // 获取余额
    function getMyMoney() {
        _getUser(function(ret) {
            view.myMoney = ret.result.score;
        })
    }
</script>

</html>